#include <iostream>
#include <list>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
    list<int> l1;
    list<int> l2(3,7);//l1 = 7 7 7
    for(int j=1;j<5;j++)
        l1.push_back(j);//l1 = 1 2 3 4
    list<int>::iterator iter1 = l1.begin(),iter2 = iter1,iter3;
    iter2++;iter2++;iter2++;
    list<int> l3(++iter1,iter2);//2,3
    list<int> l4(l1);// 1 2 3 4
    iter1 = l4.begin();
    l4.splice(++iter1,l2);//1 7 7 7 2 3 4 5
    l2 = l1;
    iter2 = l2.begin();
    l4.splice(iter1,l2,++iter2);//1 7 7 7 2 2 3 4 5
    iter2 = l2.begin();
    iter3 = iter2;
    l4.splice(iter1,l2,iter2,++iter3);
    l4.remove(1);
    l4.sort();
    l4.unique();
    l1.merge(l2);
    l3.reverse();
    l4.reverse();
    l3.merge(l4,greater<int>());
    l3.remove_if(bind2nd(not_equal_to<int>(),3));
    l3.unique(not_equal_to<int>());
    return 0;
}